
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
<meta name="keywords" content="{$SEO['keyword']}">
<meta name="description" content="{$SEO['description']}">
<link href="{THEME_STYLE_PATH}style/css/default_new.css" type="text/css" rel="stylesheet" />
<script src="{THEME_STYLE_PATH}style/js/jquery.min.js"></script>
<script src="{THEME_STYLE_PATH}style/js/core.js"></script>
<link href="{THEME_STYLE_PATH}style/css/percenter.css" type="text/css" rel="stylesheet" />
<!--[if IE 6]>
<script src="/js/DD_belatedPNG.js"></script>
<script>
  DD_belatedPNG.fix('*');
</script>
<![endif]-->
<!--[if IE 6]>
<style type="text/css">
    html{overflow:hidden;}
    body{height:100%;overflow:auto;}
</style>
<![endif]-->
</head>

<style>
.Navon {margin: 0 10px;position: relative;}
.Navun {margin: 0 10px;position: relative;}
#Nav .xinren {
	display: block;
	overflow: hidden;
	position: absolute;
	right: -10px;
	top: 8px;
}

#Nav .luntan,
#Nav .youxi,
#Nav .huiyuan {
	display: block;
	overflow: hidden;
	position: absolute;
	left: -10px;
	top: -15px;
}

#Nav .luntan {
	width: 54px;
	top: -15px;
	left: -5px;
}

</style>
<body>
		
	{include template('header','common')}
	<div id="Mainbox">
<!--插入侧边栏-->
		{include template('sidebar_login','common')}
		<!--插入侧边栏-->
		{include template('top_advance','common')}
		
		<!-- 左侧 -->
		{include template('member_left','common')}
		<!--右侧-->
		<div class="percenter_right">
			<div class="aboutper_acc">
				<p class="a1" style="margin-bottom:15px;">兑换{type_change()}豆</p>
				<ul class="pay_bank">
					<li class="a1">
					<strong>当前{type_change()}币：</strong><span class="ofe" id="jyx_span_gold"><strong><?php echo  number_format($info['u_coin']);?></strong></span><img src="{THEME_STYLE_PATH}style/images/ub.gif" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<strong>当前{type_change()}豆：</strong><span class="udcl"><strong id="jyx_span_dou"><?php echo  number_format($info['u_bean']);?></strong></span><img src="{THEME_STYLE_PATH}style/images/ud.gif" /></li>
					<li class="a2">兑换数量：</li>
					<li class="a3"><select id="exchangeType" onchange="douChange()" style="width:200px;"><option value="0">请选择兑换数量</option><option value="2">2万{type_change()}币</option><option value="5">5万{type_change()}币</option><option value="10">10万{type_change()}币</option><option value="50">50万{type_change()}币</option><option value="100">100万{type_change()}币</option><option value="500">500万{type_change()}币</option></select>&nbsp;&nbsp;您将获得<span class="udcl"><i id="jyx_span_getdou">0</i><img src="{THEME_STYLE_PATH}style/images/ud.gif"  style="margin-left:2px; vertical-align:1px;"/></span> <span class="re1" id="jxy_error1"></span></li>
					
					<li class="a2">账户密码：<li>
					<li class="a3"><input type="password" id="jxy_input_pwd"/>&nbsp;&nbsp;<span class="re1" id="jxy_error2"></span></li>
					<li class="a2"></li>
					<li class="a3" style="margin-top:10px;"><a href="javascript:void(0);" class="editbtn" id="exchange_sure" onclick="doSure()">确定兑换</a></li>
				</ul>	
			</div>					
		</div>
		<!--右侧-->
		<div class="clear"></div>
	</div>
	<!--主体-->
	<!--尾部-->
	{include template('footer','common')}


	<!--尾部-->
</body>
</html>
<script type="text/javascript">
var userG = "{$info['u_coin']}";var userF = "{$info['u_bean']}";var isLimit = true;
function douChange(){
	var v = $('#exchangeType').val();
	var d = juxiangyou.core.func.formatCurrency(v*10000*10);
	$('#jyx_span_getdou').html(d);

	var g = userG*1-v*10000;
	var gd = juxiangyou.core.func.formatCurrency(g);
	$('#jyx_span_gold').html(gd);

	var f = userF*1+v*10000*10;
	var fd = juxiangyou.core.func.formatCurrency(f);
	$('#jyx_span_dou').html(fd);
}

function doSure(){
	var v = parseInt($('#exchangeType').val());
	var p = $('#jxy_input_pwd').val().trim();
	if(!v){
		$('#jxy_error1').html("请选择您所兑换的数量！");
		$('#jxy_error1').show();
		setTimeout("$('#jxy_error1').hide();",1500);
		return;
	}else if(!p){
		$('#jxy_error2').html("请填写登录密码！");
		$('#jxy_error2').show();
		setTimeout("$('#jxy_error2').hide();",1500);
		return;
	}
	if(!isLimit) return;
	isLimit = false;
	$.ajax({
		type:'POST',
		url:"{U('Member/Score/change_bean')}",
		data:{"act":'exchangeDou',"v":v,"p":p},
		dataType:'json',
		success:function(data){
			if(data.flag==1){
				var _html = '<li class="a1"><strong>当前{type_change()}币：</strong><span class="ofe"><strong>'+data.gold+'</strong></span><img src="{THEME_STYLE_PATH}style/images/ub.gif" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>当前{type_change()}豆：</strong><span class="udcl"><strong>'+data.dou+'</strong></span><img src="{THEME_STYLE_PATH}style/images/ud.gif" /></li><li class="a4">您已成功兑换</li><li class="a5"><span class="udcl">'+data.getDou+'{type_change()}豆</span></li><li class="a6"><a href="{U('Member/Profile/exc_bean')}" class="b40link">继续兑换>></a></li>';
				$('.pay_bank').html(_html);
			}else{
				$('#jxy_error2').html(data.msg);
				$('#jxy_error2').show();
				setTimeout("$('#jxy_error2').hide();",1500);
			}
			isLimit = true;$('#exchange_sure').html("确定兑换");
		}
	});
}

</script>